/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "menu")
@NamedQueries({
    @NamedQuery(name = "Menu.findAll", query = "SELECT m FROM Menu m"),
    @NamedQuery(name = "Menu.findByMenuId", query = "SELECT m FROM Menu m WHERE m.menuId = :menuId"),
    @NamedQuery(name = "Menu.findByName", query = "SELECT m FROM Menu m WHERE m.name = :name"),
    @NamedQuery(name = "Menu.findByUrl", query = "SELECT m FROM Menu m WHERE m.url = :url"),
    @NamedQuery(name = "Menu.findByParent", query = "SELECT m FROM Menu m WHERE m.parent = :parent"),
    @NamedQuery(name = "Menu.findByOrder", query = "SELECT m FROM Menu m WHERE m.order = :order")})
public class Menu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "menuId")
    private Short menuId;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "url")
    private String url;
    @Basic(optional = false)
    @Column(name = "parent")
    private boolean parent;
    @Basic(optional = false)
    @Column(name = "order")
    private short order;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "menu")
    private Collection<Submenu> submenuCollection;

    public Menu() {
    }

    public Menu(Short menuId) {
        this.menuId = menuId;
    }

    public Menu(Short menuId, String name, String url, boolean parent, short order) {
        this.menuId = menuId;
        this.name = name;
        this.url = url;
        this.parent = parent;
        this.order = order;
    }

    public Short getMenuId() {
        return menuId;
    }

    public void setMenuId(Short menuId) {
        this.menuId = menuId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public boolean getParent() {
        return parent;
    }

    public void setParent(boolean parent) {
        this.parent = parent;
    }

    public short getOrder() {
        return order;
    }

    public void setOrder(short order) {
        this.order = order;
    }

    public Collection<Submenu> getSubmenuCollection() {
        return submenuCollection;
    }

    public void setSubmenuCollection(Collection<Submenu> submenuCollection) {
        this.submenuCollection = submenuCollection;
    }
/*
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (menuId != null ? menuId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Menu)) {
            return false;
        }
        Menu other = (Menu) object;
        if ((this.menuId == null && other.menuId != null) || (this.menuId != null && !this.menuId.equals(other.menuId))) {
            return false;
        }
        return true;
    }

    @Override	*/
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Menu[ menuId=" + menuId + " ]";
    }
    
}
